<template>
  <div class="bg">
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      :ellipsis="false"
      @select="handleSelect"
      text-color="#000000"
      active-text-color="#E11BAA"
      background-color="rgba(0,0,0,0)"
    >
      <el-menu-item index="0">
        <img
          style="width: 70px"
          src="../../../public/logo.png"
          alt="Element logo"
        />
        <h1 style="padding-top: 10px; margin-bottom: 0px; color: #e11baa">
          组件库学习系统
        </h1>
      </el-menu-item>
      <el-sub-menu index="2">
        <template #title>Workspace</template>
        <el-menu-item index="2-1">item one</el-menu-item>
        <el-menu-item index="2-2">item two</el-menu-item>
        <el-menu-item index="2-3">item three</el-menu-item>
        <el-sub-menu index="2-4">
          <template #title>item four</template>
          <el-menu-item index="2-4-1">item one</el-menu-item>
          <el-menu-item index="2-4-2">item two</el-menu-item>
          <el-menu-item index="2-4-3">item three</el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
      <el-menu-item index="1" @click="gotoElement">Element+组件库</el-menu-item>

      <el-menu-item index="0" @click="gotoTest">测试环境</el-menu-item>
    </el-menu>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
// 路由跳转
const router = useRouter()
const gotoTest = () => router.push('/test')
const gotoElement = () => router.push('/element')

const activeIndex = ref('1')
const handleSelect = (key, keyPath) => {
  console.log(key, keyPath)
}
</script>

<style lang="scss" scoped>
.bg {
  background-image: url(../../assets/img/1.jpeg);
  background-position: center -50px;
}
.el-menu--horizontal {
  --el-menu-horizontal-height: 70px;
}
.el-menu--horizontal.el-menu {
  border-bottom: 0px solid;
}
.el-menu--horizontal > .el-menu-item:nth-child(1) {
  margin-right: auto;
}
</style>
